package pl.sar.auth.server.ejb.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table( name = "PERMISSIONS" )
public class Permission implements Serializable
{

    private static final long serialVersionUID = -1348163243937956940L;

    @Id
    @GeneratedValue( strategy = GenerationType.IDENTITY )
    private long id;

    @Column( name = "name", unique = true, nullable = false )
    private String name;

    @Column( name = "value" )
    private String value;

    @Column( name = "description" )
    private String description;

    @JoinColumn( name = "role_id", referencedColumnName = "id" )
    @ManyToOne( optional = false )
    private Role role;

    public Permission()
    {
    }

    public long getId()
    {
        return id;
    }

    public void setId( long id )
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName( String name )
    {
        this.name = name;
    }

    public String getValue()
    {
        return value;
    }

    public void setValue( String value )
    {
        this.value = value;
    }

    public String getDescription()
    {
        return description;
    }

    public void setDescription( String description )
    {
        this.description = description;
    }

}
